<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://www.springside.org.cn/tags/shiro" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>查看信息</title>

	<!-- 使用bootbox的增强式alert/confirm/prompt -->	
	<script src="${ctx}/static/metronic/assets/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
	<script>
	//http://bootboxjs.com/
	function publish(id){
		bootbox.confirm("确实发布这条产品？", function(result) {
            if(result){
				location.href = "${ctx}/product/publish/" + id;
            }
        }); 
	}
	</script>
	
	<!-- select2组合框 -->
	<link rel="stylesheet" type="text/css" href="${ctx}/static/metronic/assets/plugins/select2/select2_metro.css"/>
	<script type="text/javascript" src="${ctx}/static/metronic/assets/plugins/select2/select2.min.js"></script>
	
</head>

<body>
 <!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- 提示信息 -->
			<c:if test="${not empty message}">
				<div id="message" class="alert alert-${not empty messageType ? messageType : 'success'}"><button data-dismiss="alert" class="close">×</button>${message}</div>
			</c:if>
			
			<hr>
			
		
			<c:if test="${not empty brands }">
				<div class="row">
				<div class="col-md-12">
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-cogs"></i>品牌列表
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-responsive">
								<table class="table table-hover">
								<thead>
								<tr>
									<th>客户</th>
									<th>编码</th>
									<th>名称</th>
									<th>父级品牌</th>
									<th>状态</th>
								</tr>
								</thead>
								<tbody>
								<c:forEach items="${brands}" var="brand">
								<tr>
									<td>${accountDict[brand.accountId]}</td>
									<td>${brand.code}</td>
									<td>${brand.name} </td>
									<td>${brandDict[brand.parentId]}</td>
									<td>
										<span class="label label-sm label-${brand.isenabled==0?'info':'success'}">
											${brand.isenabled==0?'草稿':'已发布'}
										</span>
									</td>
								</tr>
								</c:forEach>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END SAMPLE TABLE PORTLET-->
				</div>
			</div>
		</c:if>		
		
					<div class="row">
				<div class="col-md-12">
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-cogs"></i>联系人列表
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-responsive">
								<table class="table table-hover">
								<thead>
								<tr>
									<th>姓名</th>
									<th>性别</th>
									<th>联系方式</th>
									<th>邮箱</th>
									<th>公司</th>
									<th>部门</th>
									<th>职务</th>
									<th>优先级</th>
									<th>状态</th>
								</tr>
								</thead>
								<tbody>
								<c:forEach items="${contacts}" var="contact">
								<tr>
									<td>${contact.contactName}
									</td>
									<td>${genderDic[contact.gender]}</td>
									<td>${contact.mobile}</td>
									<td>${contact.email}</td>
									<td>${contact.company}</td>
									<td>${contact.department}</td>
									<td>${contact.post}</td>
									<td>${contact.priority}</td>
									<td>
										<span class="label label-sm label-${contact.isenabled==0?'info':'success'}">
											${contact.isenabled==0?'草稿':'已发布'}
										</span>
									</td>
								</tr>
								</c:forEach>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END SAMPLE TABLE PORTLET-->
				</div>
			</div>
			
		<c:if test="${not empty products }">
			<!-- 数据表格 -->
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-cogs"></i>产品列表
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-responsive">
								<table class="table table-hover">
								<thead>
								<tr>
									<th>编码</th>
									<th>名称</th>
									<th>品牌</th>
									<th>状态</th>
								</tr>
								</thead>
								<tbody>
								<c:forEach items="${products}" var="product">
								<tr>
									<td>${product.code}</td>
									<td>
										 ${product.name}
									</td>
									<td>${brandDict[product.brandId]}</td>
									<td>
										<span class="label label-sm label-${product.isenabled==0?'info':'success'}">
											${product.isenabled==0?'草稿':'已发布'}
										</span>
									</td>
								</tr>
								</c:forEach>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END SAMPLE TABLE PORTLET-->
				</div>
			</div>
		</c:if>
					<!-- 数据表格 -->
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-cogs"></i>广告活动列表
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-responsive">
								<table class="table table-hover">
								<thead>
								<tr>
									<th>编码</th>
									<th>名称</th>
									<th>类型</th>
									<th>品牌</th>
									<th>产品</th>
									<th>城市</th>
									<th>开始时间</th>
									<th>结束时间</th>
									<th>状态</th>
								</tr>
								</thead>
								<tbody>
								<c:forEach items="${campaigns}" var="campaign">
								<tr>
									<td>${campaign.code}</td>
									<td>
										${campaign.name}
									</td>
									<td>${campaignTypeDict[campaign.type]}</td>
									<td>${brandDict[campaign.brandId]}</td>
									<td>${productDict[campaign.productId]}</td>
									<td>${campaign.city}</td>
									<td><fmt:formatDate value="${campaign.beginTime}" pattern="yyyy-MM-dd"/></td>
									<td><fmt:formatDate value="${campaign.endTime}" pattern="yyyy-MM-dd"/></td>
									<td>
										<span class="label label-sm label-${campaign.isenabled==0?'info':'success'}">
											${campaign.isenabled==0?'草稿':'已发布'}
										</span>
									</td>
								</tr>
								</c:forEach>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END SAMPLE TABLE PORTLET-->
				</div>
			</div>
			
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-cogs"></i>排期列表
							</div>
						</div>
						<div class="portlet-body">
							<div class="table-responsive">
								<table class="table table-hover">
								<thead>
								<tr>
									<th>编码</th>
									<th>名称</th>
									<th>品牌</th>
									<th>活动</th>
									<th>总净价</th>
									<th>开始事件</th>
									<th>结束时间</th>
									<th>当前状态</th>
								</tr>
								</thead>
								<tbody>
								<c:forEach items="${spotss}" var="spots">
								<tr>
									<td>${spots.code}</td>
									<td>
										${spots.name}
									</td>
									<td>${brandDict[spots.brandId]}</td>
									<td>${campaignDict[spots.campaignId]}</td>
									<td>${spots.netPrice}</td>
									<td><fmt:formatDate value="${spots.beginTime}" pattern="yyyy-MM-dd"/></td>
									<td><fmt:formatDate value="${spots.endTime}" pattern="yyyy-MM-dd"/></td>
									<td>
										<span class="label label-sm label-${spots.isenabled==0?'info':'success'}">
											${spotsTypeDict[spots.type]}
										</span>
										<span class="label label-sm label-${spots.isenabled==0?'info':'success'}">
											${spots.isenabled==0?'草稿':(spots.excelIsenabled==0?'编辑excel':'已发布')}
										</span>
									</td>
								</tr>
								</c:forEach>
								</tbody>
								</table>
							</div>
						</div>
					</div>
					<!-- END SAMPLE TABLE PORTLET-->
				</div>
			</div>
			
			<div class="row">
				<div class="col-md-12">
					<button type="button" class="btn default" onclick="history.back()">返回</button>
				</div>
			</div>
		</div>
	</div> 
</body>
</html>
